public class test525_2 {
    public static void main(String[] args) {
        //找最大值及其所有最大值的下标
        int[] arr1 = {4, 5, 6, 1, 9, 3, 9};
        int max = arr1[0];
        for (int i = 1; i < arr1.length; i++) {
            if (max < arr1[i]) {
                max = arr1[i];
            }
        }
        System.out.println("最大值为：" + max);
        for (int i = 0; i < arr1.length; i++) {
            if (max == arr1[i]) {
                System.out.print("所对应的下标为：" + i + "\t");
            }
        }
        System.out.println();
        int[] arr = {4,5,6,1,9,9,3};
        //找最大值
        int max1 = arr[0];
        String index = "0";
        for(int i=1; i<arr.length; i++){
            if(arr[i] > max1){
                max1 = arr[i];
                index = i + "";
            }else if(arr[i] == max1){
                index += "," + i;
            }
        }
        System.out.println("最大值是" + max1);
        System.out.println("最大值的下标是[" + index+"]");

    }
}